package com.jy.wms.common;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class TimeUtils {

    /*
        fpsj_start 起始时间
        fpsj_end   结束时间
     */

    public Map<String,String> TimeConversion(Map<String, Long> mapp,String fpsj_start,String fpsj_end){
        Map map=new HashMap<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
        if (mapp.containsKey(fpsj_start) && mapp.containsKey(fpsj_end)){

            long start_time = mapp.get(fpsj_start);
            long End_time= mapp.get(fpsj_end);

            Calendar c = Calendar.getInstance();
            c.setTimeInMillis(start_time);
            Date date = c.getTime();
            String date1=sdf.format(date);
            map.put(fpsj_start,date1);

            c.setTimeInMillis(End_time);
            Date date2 = c.getTime();
            String date3=sdf.format(date2);
            map.put(fpsj_end,date3);
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return map;
    }
}
